function fireClick(node){
   console.log("doing click!!!!");
   if ( document.createEvent ) {
      var evt = document.createEvent('MouseEvents');
      evt.initEvent('click', true, false);
      node.dispatchEvent(evt);   
   } else if( document.createEventObject ) {
      node.fireEvent('onclick') ;   
   } else if (typeof node.onclick == 'function' ) {
      node.onclick();   
   }
}


try {
var sa = document.getElementsByClassName("lt-show-all")[0];
sa.childNodes[1].click();


var components = Ext.ComponentQuery.query("component[cls='lt-pagination']");
//components[0].fireEvent("pagesizechange", Loyalty.pageSizeAll);
components[0].fireEvent("pagesizechange", -1);

} catch(err) {
  console.log("first error: " + err);
}
console.log("starting up");
var els = document.getElementsByClassName("lt-add-offer-link")
console.log(els.length);
for (x = 0; x< els.length; x++) {
   if (els[x].offsetHeight == 0 ) { continue; }
   console.log(els[x]);
   els[x].click();
}

/*
n = []
var els = document.getElementsByClassName("lt-add-offer");
for(x = 0; x < els.length; x++) { if(els[x].offsetHeight > 0) { n.push(els[x]); } }

console.log(n.length)



ttimer = setInterval(function(){doclicks()},100);

  function doclicks() {
     el = n.shift()
       if(el) {
           console.log("EL: " + el);
        el.firstElementChild.click()
        //fireClick(el);
            } else {
       clearInterval(ttimer);
      }
    }

*/
